import { CustRequest } from "./api/cust_request";
import { BackendApi } from "./api/backend_api";
export let initImUserSig = function(params, callback){
	
	if(params.imUserSig){
		uni.$chat_userID = params.imUserId
		uni.$chat_userSig = params.imUserSig;
		callback({code:200,data:{imUserSig:params.imUserSig, imUserId: params.imUserId}})
	}else{
		BackendApi.tencentIm_genUserSig().then(res => {
			if(res.code == 200){
				uni.$chat_userSig = res.data.imUserSig
				uni.$chat_userID = res.data.imUserId
				callback(res)
			}else{
				console.log('获取imUserSig失败', res)
				callback({code: 500, msg: '获取imUserSig失败'})
			}
		})
	}
}